package com.cw.controller;


import com.cw.common.api.ResultObject;
import com.cw.dto.SystemLogCondition;
import com.cw.dto.operationLogDTO;
import com.cw.entity.*;
import com.cw.service.*;
import com.cw.util.PageHelperTool;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;

import java.util.*;

import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xnd
 * @since 2023-11-20
 */
//后续也可以作为系统日志增删改查的一个日志表
@Api(tags = {"日志操作监听表"})
@RestController
@RequestMapping("/listening-log")
public class ListeningLogController {

    @Autowired
    private IListeningLogService listeningLogService;


    @ApiOperation("操作日志列表")
    @PostMapping("/operationLogPageList")
    public ResultObject operationLogPageList(@RequestBody operationLogDTO dto) {
        List<ListeningLog> listeningLogs = listeningLogService.operationLogPageList(dto);
        PageInfo<ListeningLog> listeningLogsPageInfo = PageHelperTool.excutePageInfo(listeningLogs,
                dto.getPageNum(), dto.getPageSize());
        return ResultObject.successReturn(listeningLogsPageInfo);
    }

    @ApiOperation("下拉获取用户")
    @PostMapping("/userList")
    public ResultObject userList(@RequestBody SystemLogCondition condition) {
        return ResultObject.successReturn(listeningLogService.userList(condition));
    }


}

